<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
    Prabhat, initial page, CSS and W3C validation
    Zaid, added Javascript
    02/03/11 Prabhat, reviewed Javascript
    Xxx, made page dynamic JSP
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
        <title>Net-Chat:Create forum</title>
        <link rel="stylesheet" type="text/css" href="../style/common.css"></link>
        <script type="text/javascript" src="../js/common.js"></script>
        <script type="text/javascript">
            function validate() {
                var forumname = document.getElementById('fname').value;
                var forumcategory = document.getElementById('fcategory').value;

                if (isValidAlphaNumField(forumname, "forum name")) {

                    if (isValidAlphaNumField(forumcategory, "forum category")) {
                        //if form is valid
                        alert("Hah, you should see what's next in Stage 2");
                        return false; // TODO: need to post for in stage 2
                    }
                }
                return false;
            }
        </script>
    </head>
    <body>
        <div id="container">
            <div id="top">
                <h1>Net-Chat</h1>
            </div>
            <div id="leftnav">
                <p>
                    New forums can be created on this page which will then be listed on the forums page so any user can join in.
                    <br/><br/>
                    * At the moment, only public forum is available and there is no limit to the maximum number of users.
                </p>
            </div>
            <div id="content">
                <h2>Create forum</h2>
                <form action="" method="post" onsubmit="return validate()">
                    <p>
                        <label class="w120" for="fname">Forum name: </label>
                        <input type="text" name="fname" id="fname" />
                        <br />
                        <label class="w120" for="fcategory">Category: </label>
                        <input type="text" name="fcategory" id="fcategory" />
                        <br />
                        <label class="w120" for="ftype">Type: </label>
                        <select name="ftype" id="ftype">
                            <option>public</option>
                            <option>private</option>
                        </select> *
                        <br />
                        <label class="w120" for="fmaxusers">Max. users: </label>
                        <select name="fmaxusers" id="fmaxusers">
                            <option>5</option>
                            <option>10</option>
                            <option>15</option>
                            <option>20</option>
                        </select> *
                    </p>
                    <p>
                        <input type="submit" name="create" id="create" value="create" />
                        <a href="forums.htm">back to forums</a>
                    </p>
                </form>
            </div>
            <div id="footer">
                <div class="alignleft">Author: Totoo, Alzaid</div>
                <div class="alignright">Network Applications</div>
                <div class="clr"></div>
            </div>
        </div>
        <p class="center">
            <a href="http://validator.w3.org/check?uri=referer">
                <img class="w3img" src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Strict" />
            </a>
            <a href="http://jigsaw.w3.org/css-validator/check/referer">
                <img class="w3img" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" />
            </a>
        </p>
    </body>
</html>